package com.wuge.springMybatis0807;

import com.wuge.springMybatis0807.dao.SpringUserDao;
import com.wuge.springMybatis0807.entity.SpringUser;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Iterator;
import java.util.List;

/**
 * Created by Administrator on 2017/8/7.
 */
public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SpringUser springUser = (SpringUser)context.getBean("springUser");
        springUser.setAge(10);
        springUser.setUserName("summer");
        springUser.setPassword("123456");
        springUser.setMoney(10000);
        SpringUserDao dao = (SpringUserDao)context.getBean("springUserDao");
        dao.addUser(springUser);
        System.out.println(dao.updateUser(springUser));
       /* List<SpringUser> userList = dao.getAllUsers();
        for(int i = 0; i < userList.size(); i++){
            System.out.println(userList.get(i).getUserName());
        }*/
}
}
